package com.yitiao.data_algorithms.leetcode.editor.cn;

class SearchInsertPosition {
    // 2023-04-03 17:55:18
    public static void main(String[] args) {
        Solution solution = new SearchInsertPosition().new Solution();
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int searchInsert(int[] nums, int target) {
            for (int i = 0; i < nums.length; i++) {
                if (target <= nums[0]) {
                    return 0;
                }
                if (nums[i] == target) {
                    return i;
                } else if (target < nums[i]) {
                    return i;
                }
            }
            return nums.length;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}